// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.fileSystem;

import java.io.IOException;
import java.io.InputStream;

public final class DeviceList {
    private final IFileDevice[] m_devices = new IFileDevice[8];

    public void add(IFileDevice device) {
        for (int _int = 0; _int < this.m_devices.length; _int++) {
            if (this.m_devices[_int] == null) {
                this.m_devices[_int] = device;
                break;
            }
        }
    }

    public IFile createFile() {
        IFile iFile = null;

        for (int _int = 0; _int < this.m_devices.length && this.m_devices[_int] != null; _int++) {
            iFile = this.m_devices[_int].createFile(iFile);
        }

        return iFile;
    }

    public InputStream createStream(String path) throws IOException {
        InputStream inputStream = null;

        for (int _int = 0; _int < this.m_devices.length && this.m_devices[_int] != null; _int++) {
            inputStream = this.m_devices[_int].createStream(path, inputStream);
        }

        return inputStream;
    }
}
